package cn.zswltech.gruul.biz.service.impl;

import cn.zswltech.gruul.biz.service.EnumsService;
import cn.zswltech.gruul.common.constant.CommonConstants;
import cn.zswltech.gruul.common.dal.vo.EnumsVO;
import cn.zswltech.gruul.common.enums.SystemCodeEnum;
import cn.zswltech.gruul.common.result.Response;
import cn.zswltech.lib.futurelog.core.common.OperTypeEnum;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 枚举接口
 *
 * @author pengfei.yu
 * @date 2024/2/27 18:02
 */
@Service
public class EnumsServiceImpl implements EnumsService {

    /**
     * 通用枚举
     *
     * @return
     */
    @Override
    public Response<Map<String, List<EnumsVO>>> commonEnums() {
        Map<String, List<EnumsVO>> map = new HashMap<>();

        // 操作日志枚举
        map.put(CommonConstants.OPER_LOG_TYPE, Arrays.stream(OperTypeEnum.values()).map(t ->
                EnumsVO.builder().value(t.getType()).label(t.getDesc()).build()).collect(Collectors.toList()));

/*        //系统code枚举
        map.put(CommonConstants.SYSTEM_CODE,Arrays.stream(SystemCodeEnum.values()).map(t ->
                EnumsVO.builder().value(t.getCode()).label(t.getSystemName()).build()).collect(Collectors.toList()));*/

        return Response.success(map);
    }
}
